Automate it! by Unknown
Author:Unknown
Language: eng
Format: mobi, epub
Publisher: Packt Publishing
How it works...
In this recipe, we used the blank template to add a two-content layout slide. Let's see what else we did on top of it:
In the code, we used prs.slide_layouts[3] to convey the presentation object, prs, to add a slide with the two content layout. The two-content layout also has a title text, which was updated to Adding a Two Content Slide by using the shapes.title attribute.
Next, we looked at the placeholders. A placeholder is a preformatted container to which content can be added. Placeholders are categories of shape, which means multiple shapes can have placeholders. For instance, an autoshape (circle, as seen in the first recipe) is a placeholder; a picture or graphic frame can be a placeholder. We have two placeholders, one on the left and one on the right, in a two-content slide. We targeted the left one with shapes.placeholders[1] and added a first line This is line 1. to the text frame referenced by shapes.placeholders[1].text_frame.
We then added bulleted lines by adding a paragraph to text_frame with the add_paragraph() method and added the text Again a line 2... at level one and And this is line 3... at level two.
Basically, not all shapes contain text, but finding if a shape supports text can be done using the shape.has_text_frame attribute. In this recipe, we know our shape contains a placeholder that can handle text content. So, we used the text_frame attribute to add the first line of text. Similarly, we used the add_paragraph() method to add the subsequent lines in bulleted fashion using the level attribute.
In the end, we saved the new presentation under the name, two_content.pptx. If you look at the screenshot, we see the bulleted look on the text added to the left text frame on the slide.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Black Swan by Nassim Nicholas Taleb(6763)
Bad Blood by John Carreyrou(6274)
Pioneering Portfolio Management by David F. Swensen(6078)
Millionaire: The Philanderer, Gambler, and Duelist Who Invented Modern Finance by Janet Gleeson(4093)
Skin in the Game by Nassim Nicholas Taleb(3965)
The Money Culture by Michael Lewis(3846)
Bullshit Jobs by David Graeber(3829)
Skin in the Game: Hidden Asymmetries in Daily Life by Nassim Nicholas Taleb(3722)
The Wisdom of Finance by Mihir Desai(3523)
Blockchain Basics by Daniel Drescher(3329)
Liar's Poker by Michael Lewis(3220)
The Intelligent Investor by Benjamin Graham Jason Zweig(2930)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2925)
Mastering Bitcoin: Programming the Open Blockchain by Andreas M. Antonopoulos(2891)
Fooled by Randomness: The Hidden Role of Chance in Life and in the Markets by Nassim Nicholas Taleb(2860)
Investing For Dummies by Eric Tyson(2793)
The Power of Broke by Daymond John(2772)
Market Wizards by Jack D. Schwager(2538)
Zero Hour by Harry S. Dent Jr. & Andrew Pancholi(2532)
